using GolSig.Library;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Test.GolSig.Library.BoardSpecs
{
    [TestClass()]
    public class WhenCallingInitialize
    {
       
        [TestMethod()]
        public void GivenOnLifeCell_ThenOnlifeCellShouldExist()
        {
            BoardSize boardSize = new BoardSize(3, 3);
            Board target = new Board(boardSize); 
            IEnumerable<CellInfo> cells = new List<CellInfo> { new CellInfo(new Position(1,1) , true)};
            target.Initialize(cells);

            var result = target.GetAllCurrentCellInfo();

            Assert.IsTrue(result.Count() == 9);
            Assert.IsTrue(result.Count(c => c.Alive == true) == 1);
        }

        [TestMethod()]
        public void GivenNoLifeCell_ThenNolifeCellShouldExist()
        {
            BoardSize boardSize = new BoardSize(3, 3);
            Board target = new Board(boardSize);
            IEnumerable<CellInfo> cells = null;
            target.Initialize(cells);

            var result = target.GetAllCurrentCellInfo();

            Assert.IsTrue(result.Count() == 9);
            Assert.IsTrue(result.Count(c => c.Alive == true) == 0);
        }
    }
}
